// Pinia store 的定义
import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    userName: '',
    userId: '',
    gender:'',
    status: 'null'
  }),
  actions: {
    setStatus(status) {
      this.status = status
    },
    setUserId(userId) {
      this.userId = userId
    },
    setUserName(userName) {
      this.userName = userName
    },
    // 添加一个清除用户信息的函数
    clearUserData() {
      this.userName = '';
      this.userId = '';
      this.status = 0;
    }
  }
})
